import {baseInsertSql, baseListSql, baseUpdateSql} from "./base-sql.ts";


export const getData = async (sql: string, params: string) => {
    return await baseListSql(sql, params);
}




/**
 * 分组
 */

export const insertGroup = async (...params: string[]) => {
    console.log(`insertGroup params:${params}`)
    return await baseInsertSql(`INSERT INTO "group" (title, father_id) VALUES (?, ?);`, ...params);
}

export const delGroup = async (params: string) => {
    console.log(`delGroup params:${params}`)
    return await baseUpdateSql(`DELETE FROM "group" WHERE id = ?;`, params);

}

export const updateGroup = async (...params: string[]) => {
    return await baseUpdateSql(`UPDATE "group" SET title = ? WHERE id = ?;`, ...params);
}

export const listGroup = async () => {
    return await baseListSql(`SELECT * FROM "group";`);
}


/**
 * 密码
 */




